<html>
	<head>
    	<?php
		require("frmHeader.php");
		require_once("includes/database.php");
		?>
        <script language='VBScript'>
			Sub Print()
				   OLECMDID_PRINT = 6
				   OLECMDEXECOPT_DONTPROMPTUSER = 2
				   OLECMDEXECOPT_PROMPTUSER = 1
				   call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
			End Sub
			document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
		</script>

	</head>
	<body onLoad="frmLogin.username.focus();">
    	<table cellpadding="0" cellspacing="0" align="center" class="tablaPrincipal">
        	<tr>
            	<td align="center">
                	<?php
					require("frmTitulo.php");
					?>
                </td>
            </tr>
            <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <?php
			if(isset($mensaje)){
			?>
                <tr>
                    <td align="center">
                        <table cellpadding="0" cellspacing="0" align="center" class="errorPrincipal">
                            <tr>
                                <td>
                                	<img src='images/error.png' class='imagen' title='<?php echo $mensaje;?>'> <?php echo $mensaje;?>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td height="20">&nbsp;
                        
                    </td>
                </tr>
            <?php
			}
			?>
            <tr>
            	<td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="loginPrincipal">
                    	<tr>
                        	<td align="center">
                                <form name="frmLogin" action="index.php" method="POST">
                                    <table width="250">
                                    	<tr>
                                        	<td width="50" align="right">
                                            	*Usuario:
                                            </td>
                                            <td width="200">
                                            	<input style="width:100%;" type="text" name="username" maxlength="50" value="<?php echo stripslashes($username);?>"/>
                                            </td>
                                        </tr>
                                        <tr>
                                        	<td align="right">
                                            	*Password:
                                            </td>
                                            <td>
                                            	<input style="width:100%;" type="password" name="contrasena" maxlength="15"/>
                                            </td>
                                        </tr>
                                        <tr>
                                        	<td>
                                            	*Sucursal:
                                            </td>
                                            <td align="right">
                                            	<select name="sucursal" style="width:100%;">
                                                <?php
												foreach($sucursales as $sucursal)
												{
													if($sucursal['idSucursal'] == $idSucursal)
													{
														$selected = "selected";
													}
													else
													{
														$selected = "";	
													}
													echo "<option value='".$sucursal['idSucursal']."' $selected>".$sucursal['nombre']."</option>";
												}
												?>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                        	<td colspan="2" align="center">
                                    			<input type="submit" name="cmdLogin" value="Acceder"/>
                                            </td>
                                        </tr>
                                    </table>
                                    <?php
									if($iOpcion==1 || $iOpcion==1)
									{
										$iOpcion = 2;	
									}
									?>
                                	<input type="hidden" name="iOpcion" value="<?php echo $iOpcion;?>"/>
                                </form>
                            </td>
                        </tr>
                        <tr>
                        	<td>
                            	<a href="javascript:window.print();">Print</a>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>                
	</body>
</html>